<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="../static/css/prism.css" rel="stylesheet" />
</head>

<body>
    <h2>length属性</h2>
    <p>注意是<strong>属性</strong>不是<strong>方法</strong></p>
    <p>length属性返回字符串的长度</p>
    <pre><code class="language-javascript">var s = 'itbaizhan';
s.length // 9</code></pre>

    <script src="../static/js/prism.min.js"></script>

    <script>
        console.log("练习开始");
        var a = "你好";
        console.log(a.length);
        var b = "hello world!";
        console.log(b.length);
        console.log("练习结束");
    </script>
</body>

</html>